﻿// <copyright file="DeleteChannel.cs" company="Hallvard Korsgaard">
//  Microsoft Public License (Ms-PL). See license details here: http://enoceannet.codeplex.com/license
// </copyright>
// <author>Hallvard Korsgaard</author>

namespace StcEthernet.Management
{
  using System;
  using EnOcean;

  /// <summary>
  /// Deletes the sensor information configured for a channel.
  /// </summary>
  [Serializable]
  public class DeleteChannel : ManagementTelegram
  {
    /// <summary>
    /// Initializes a new instance of the DeleteChannel class.
    /// </summary>
    public DeleteChannel()
    {
    }

    /// <summary>
    /// Initializes a new instance of the DeleteChannel class.
    /// </summary>
    /// <param name="channel">The channel number to delete.</param>
    public DeleteChannel(byte channel)
    {
      this.Channel = channel;
    }
    
    /// <summary>
    /// Gets or sets the channel to delete.
    /// </summary>
    public byte Channel
    {
      get;
      set;
    }

    /// <summary>
    /// Creates the byte format of the message.
    /// </summary>
    /// <param name="message">A byte array of length 10 to hold the message contents.</param>
    protected internal override void CreateMessage(byte[] message)
    {
      base.CreateMessage(message);

      message[2] = 0x94;
      message[3] = this.Channel;
      message[4] = 0x01;
      message[5] = 0x02;
      message[6] = 0x03;
      message[7] = 0x04;
      message[8] = 0x05;
      message[9] = 0x06;
    }
  }
}
